package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCUtil {
    Connection con;
    String driver = "com.mysql.cj.jdbc.Driver";
    String url="jdbc:mysql://localhost:3306/library";
    String username="root";
    String password="17876724541";
    public Connection getCon(){
        try {
            Class.forName(driver);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        try {
            con = DriverManager.getConnection(url,username,password);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return con;
    }
}
